<%-- 
    Document   : AgrEditCargo
    Created on : 23-ene-2012, 19:36:57
    Author     : Ale
--%>

<%@page import="edu.uci.quinto.Managers.CargoManager"%>
<%@page import="edu.uci.quinto.Pojos.Cargo"%>
<%@page import="java.util.*"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
            String mess = (String)session.getAttribute("mess");
            session.setAttribute("mess",null);
            int id = 0;
            if (request.getParameter("id")!=null)
            {
                id = Integer.parseInt(request.getParameter("id"));
            }
            CargoManager cargoManager = new CargoManager();
            Cargo cargo = null;
            if(id > 0)
            {
                cargo = cargoManager.getCargo(id);
            }
            else
            {
                cargo = new Cargo();
            }
            pageContext.setAttribute("mess", mess);
            pageContext.setAttribute("cargo", cargo);

        %>
        
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Tecnologias III --- GDIT: Agregar / Editar Cargo</title>
    </head>
    <body>
        <a href="../../index.jsp">Inicio</a>
        <h1>
           ${mess}
        </h1>

        <h1>Agregar / Editar Cargo</h1>
        <form action="../../CargoController" method="post">
               <table frame="box">
                  <tr>
                      <th>Id:</th>
                      <td>
                          <c:if test="${cargo.id != null}"> ${cargo.id} </c:if>
                          <c:if test="${cargo.id == null}"> n/a </c:if>
                          <input name="cargoId" value="${cargo.id}" type="hidden" />
                      </td>
                  </tr>
                  <tr>
                      <th>Descripcion Cargo</th>
                      <td><input name="cargoDescripcion" value="${cargo.descripcion}" type="text" /></td>
                  </tr>
                  
           </table>
              <input type="submit" value="Guardar y Listar" name="saveCargo"/>
              <input type="submit" value="Guardar y Agregar" name="saveAddCargo"/>
        </form>
    </body>
</html>


